<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.10/dist/vue.js"></script>
</head>

<body>
    <div id="app">
        <App/>
    </div>
    <script>
        Vue.config.productionTip = false;

        // 1.使用Vue.extend({})创建组件
        // 组件都是独立的
        const App = Vue.extend({
            template: `
          <div>
            <h1>App组件{{count}}</h1> 
            <button @click="changeCount">累加</button>
          </div>
        `,
        data() {
            return {
                count:0,
            }
        },
        methods: {
            changeCount(){
                this.count++;
            }
        },
        })
        
        const vm = new Vue({
            el: "#app",
            data() {
                return {
                    
                }
            },
            // 注册组件
            components:{
                App,
            }
        })
</script>
</body>

</html>